#include "gdt.h"
#include "tss.h"

gdt_entry gdt[GDT_COUNT] = {
	/* Descriptor nulo*/
	(gdt_entry){(unsigned int) 0x00000000, (unsigned int) 0x00000000 },
		
	/*Descriptor segmento codigo nivel cero*/
	(gdt_entry){	(unsigned short) 0xffff, 
			(unsigned short) 0x0000,
			(unsigned char) 0x0,
			(unsigned char) 0xA,
			(unsigned char) 0x1,
			(unsigned char) 0x0,
			(unsigned char) 0x1,
			
			(unsigned char) 0xf,
			(unsigned char) 0x1,
			(unsigned char) 0x0,
			(unsigned char) 0x1,
			(unsigned char) 0x1,
			(unsigned char) 0x00},		
		
	/*Descriptor segmento datos nivel cero*/
	(gdt_entry){	(unsigned short) 0xffff, 
			(unsigned short) 0x0000,
			(unsigned char) 0x0,
			(unsigned char) 0x2,
			(unsigned char) 0x1,
			(unsigned char) 0x0,
			(unsigned char) 0x1,
			
			(unsigned char) 0xf,
			(unsigned char) 0x1,
			(unsigned char) 0x0,
			(unsigned char) 0x1,
			(unsigned char) 0x1,
			(unsigned char) 0x00},
	
	/*Descriptor segmento video */
	(gdt_entry){	(unsigned short) 0x0F9F,
			(unsigned short) 0x8000,
			(unsigned char) 0x0B,
			(unsigned char) 0x2,
			(unsigned char) 0x1,
			(unsigned char) 0x0,
			(unsigned char) 0x1,
			(unsigned char) 0x0,
			(unsigned char) 0x0,
			(unsigned char) 0x0,
			(unsigned char) 0x0,
			(unsigned char) 0x0,
			(unsigned char) 0x00},

	
		/*Descriptor segmento codigo nivel 3*/
	(gdt_entry){	(unsigned short) 0xffff, 
			(unsigned short) 0x0000,
			(unsigned char) 0x0,
			(unsigned char) 0xA,
			(unsigned char) 0x1,
			(unsigned char) 0x3,
			(unsigned char) 0x1,
			
			(unsigned char) 0xf,
			(unsigned char) 0x1,
			(unsigned char) 0x0,
			(unsigned char) 0x1,
			(unsigned char) 0x1,
			(unsigned char) 0x00},		
		
	/*Descriptor segmento datos nivel 3*/
	(gdt_entry){	(unsigned short) 0xffff, 
			(unsigned short) 0x0000,
			(unsigned char) 0x0,
			(unsigned char) 0x2,
			(unsigned char) 0x1,
			(unsigned char) 0x3,
			(unsigned char) 0x1,
			
			(unsigned char) 0xf,
			(unsigned char) 0x1,
			(unsigned char) 0x0,
			(unsigned char) 0x1,
			(unsigned char) 0x1,
			(unsigned char) 0x00},

};

gdt_descriptor GDT_DESC = {sizeof(gdt)-1, (unsigned int)&gdt};


const int ULTIMA_TAREA_ASM = ULTIMA_TAREA;
const int TAREA1_ASM = TAREA1;
const int TSS_COUNT_ASM = TSS_COUNT;
